// pages/createResume/index.js
import DB from '../../utils/db';

Page({

  /**
   * 页面的初始数据
   */
  data: {
    image: 'https://tdesign.gtimg.com/mobile/demos/avatar1.png',
  },


  personalKeyInformation(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/personalKeyInformation/index?id=${id}`,
    })
  },

  evaluation(e) {
    const id = e.currentTarget.dataset.id;
    // console.log(this.data.record.personalKeyInformation.postText)
    wx.setStorageSync('专业', this.data.record.personalKeyInformation.postText)
    wx.navigateTo({
      url: `/pages/evaluation/index?id=${id}`,
    })
  },
  workExperience(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/workExperience/index?id=${id}`,
    })
  },

  education(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/education/index?id=${id}`,
    })
  },

  project(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/project/index?id=${id}`,
    })
  },

  qualificationCertificate(e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/qualificationCertificate/index?id=${id}`,
    })
  },

  selectCreateResume() {
    // console.log(this.data.openId)
    DB.select('selectCreateResume', this.data.openId).then((resp) => {
      console.log(resp)
      this.setData({
        record: resp.result,
      });
      wx.hideLoading();
    }).catch(() => {
      console.log(e);
      this.setData({
        showUploadTip: true
      });
      wx.hideLoading();
    });

  },



  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      'openId': wx.getStorageSync("openId")
    })
    wx.showLoading({
      title: '数据加载中...', // 这里设置提示词
      mask: true // 显示透明蒙层
    });
    this.selectCreateResume()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
    // console.log(this.data.record[0])
    // this.data.form.openId = this.data.openId
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage() {

  // },



})